from django import http
from django.contrib.auth.mixins import LoginRequiredMixin

from meiduo_mall.utils.response_code import RETCODE

# 重写handle_no_permission方法，自定义判断用户是否登录的扩展类：返回json
class LoginRequiredJsonMixin(LoginRequiredMixin):
    def handle_no_permission(self):
        return http.JsonResponse({'code':RETCODE.SEESSIONERR,'errmsg':'用户未登录'})
